wrong data type in mysql for grails byte[] property

Posted by srkiNZ84 on Stack Overflow See other posts from Stack Overflow or by srkiNZ84
Published on 2010-12-26T08:48:55Z Indexed on 2010/12/26 8:53 UTC
Read the original article Hit count: 194

Filed under:
|
|

Hi,

I have an application which is trying to save a photo to the database. I've created a grails domain class with a byte[] property and this was working well when using HSQLDB (the default in grails). However, when I changed the database to MySQL I ended up getting the following error:

Data truncation: Data too long for column 'photo' at row 1

I then had a look at the schema and found that the byte[] was being created as a TINYBLOB field, which was causing the error.

How can I specify that this property should correspond to a BLOB/LONGBLOB type in the database?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about grails